﻿using System;
using System.Collections.Generic;
using System.Data;
using Smarly.Bussines.Membership;
using Smarly.Core;
using Smarly.Core.Database;

namespace Smarly.Bussines.Model.Account
{
	public class Viewer : ModelStateObject
	{
		public Viewer Post(SmarlyIdentity user, DateTime expired)
		{
			if (user == null)
				return this;
			return SqlRepository.ExecuteProcedureReader("Text_User_Update",
																					 new List<SpParam>
			                                     	{
			                                     		new SpParam {Name = "@userId", Type = DbType.Guid, Value = user.UserId},
			                                     		new SpParam {Name = "@expired", Type = DbType.DateTime, Value = expired},
			                                     	},
																					 OnSqlInfoMessage,
																					 reader => this);
		}
	}
}